# -*- coding: UTF-8 -*-
import socket

# 服务器
s = socket.socket();
host = socket.gethostname();
s.bind((host, 12345));
s.listen(5);
while True:
    c, addr = s.accept();
    print("连接地址：" + addr);
    c.send("来自服务器的消息");
    c.close();

# 客户端
s1 = socket.socket();
host1 = socket.gethostname();
s1.connect(host1, 12345);
content = s1.recv(1024);
print(content);
s1.close;
